# coding: utf-8
from sqlalchemy import Column, DateTime, String, Text
from sqlalchemy.dialects.mysql import BIGINT, INTEGER, TINYINT
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
metadata = Base.metadata


class Alarmclas(Base):
    __tablename__ = 'alarmclass'

    alarm_class_code = Column(String(255), primary_key=True)
    description = Column(String(255))


class Alarmdealstandard(Base):
    __tablename__ = 'alarmdealstandard'

    ID = Column(BIGINT(20), primary_key=True, nullable=False)
    alarm_name = Column(String(100), primary_key=True, nullable=False)
    alarm_group_code = Column(String(100))
    alarm_deal_standard = Column(String(1000))
    description = Column(String(100))


class Alarmdefine(Base):
    __tablename__ = 'alarmdefine'

    ID = Column(BIGINT(20), primary_key=True)
    calc_class = Column(String(50))
    statistical_type = Column(String(50))
    ifconditions = Column(String(50))
    symbol = Column(String(50))
    standvalue = Column(String(50))
    conditon_relation = Column(String(50))
    redistag = Column(String(50))
    issplit = Column(String(50))
    splitnumber = Column(String(50))
    splitposition = Column(String(50))
    description = Column(String(100))


class Alarmeventdetail(Base):
    __tablename__ = 'alarmeventdetail'

    ID = Column(BIGINT(255), primary_key=True)
    UUID = Column(String(255))
    equipmentID = Column(String(255))
    equipmentcode = Column(String(255))
    alarm_name = Column(String(255))
    alarm_starttime = Column(String(255))
    alarm_endtime = Column(String(255))
    alarm_duration_time = Column(String(255))
    description = Column(String(255))
    alarm_class_code = Column(String(255))
    alarm_grade_code = Column(String(255))
    alarm_group_code = Column(String(255))
    alarm_year = Column(String(255))
    alarm_month = Column(String(255))
    alarm_day = Column(String(255))
    alarm_hour = Column(String(255))
    alarm_minute = Column(String(255))
    alarm_second = Column(String(255))
    alarm_status = Column(String(255))


class Alarmgrade(Base):
    __tablename__ = 'alarmgrade'

    alarm_grade_code = Column(String(255), primary_key=True)
    alarm_grade_level = Column(String(255))
    description = Column(String(255))


class Alarmgroup(Base):
    __tablename__ = 'alarmgroup'

    alarm_group_Code = Column(String(255), primary_key=True)
    description = Column(String(255))


class Alarmmode(Base):
    __tablename__ = 'alarmmode'

    ID = Column(BIGINT(255), primary_key=True)
    datatype = Column(String(255))
    alarm_create_mode = Column(String(255))
    description = Column(String(255))


class Alarmrunmodel(Base):
    __tablename__ = 'alarmrunmodel'

    ID = Column(BIGINT(20), primary_key=True)
    equipmentcode = Column(String(50))
    calc_class = Column(String(50))
    statistical_type = Column(String(50))
    ifconditions = Column(String(50))
    symbol = Column(String(50))
    standvalue = Column(String(50))
    conditon_relation = Column(String(50))
    redistag = Column(String(50))
    description = Column(String(100))


class Alarmrunmodel1(Base):
    __tablename__ = 'alarmrunmodel1'

    ID = Column(BIGINT(20), primary_key=True)
    equipmentID = Column(String(50))
    calc_class = Column(String(50))
    statistical_type = Column(String(50))
    ifconditions = Column(String(50))
    symbol = Column(String(50))
    standvalue = Column(String(50))
    conditon_relation = Column(String(50))
    redistag = Column(String(50))
    description = Column(String(100))


class Cellruneventdetail(Base):
    __tablename__ = 'cellruneventdetail'

    ID = Column(BIGINT(20), primary_key=True, nullable=False)
    cellID = Column(BIGINT(20), primary_key=True, nullable=False)
    event_name = Column(String(100))
    event_starttime = Column(DateTime)
    event_endtime = Column(DateTime)
    event_duration_time = Column(String(50))
    description = Column(String(100))
    event_year = Column(String(50))
    event_month = Column(String(50))
    event_day = Column(String(50))
    event_hour = Column(String(50))
    event_minute = Column(String(50))
    event_second = Column(String(50))
    event_status = Column(String(50))


class Cellrunmodel(Base):
    __tablename__ = 'cellrunmodel'

    ID = Column(BIGINT(20), primary_key=True)
    cellID = Column(String(50))
    calc_class = Column(String(50))
    statistical_type = Column(String(50))
    ifconditions = Column(String(50))
    symbol = Column(String(50))
    standvalue = Column(String(50))
    duration_time = Column(String(50))
    redistag = Column(String(50))
    description = Column(String(100))


class DataRealtimeTag(Base):
    __tablename__ = 'data_realtime_tag'

    ID = Column(INTEGER(11), primary_key=True)
    tagID = Column(String(64))
    tagtablename = Column(String(64))


class Electricprice(Base):
    __tablename__ = 'electricprice'

    ID = Column(BIGINT(255), primary_key=True)
    PriceName = Column(String(255))
    PriceValue = Column(String(255))
    PriceType = Column(String(255))
    StartTime = Column(String(255))
    EndTime = Column(String(255))
    IsEnabled = Column(String(255))
    Description = Column(String(255))
    Unit = Column(String(255))


class Equipment(Base):
    __tablename__ = 'equipment'

    ID = Column(INTEGER(11), primary_key=True)
    EquipmentName = Column(String(128))
    EquipmentCode = Column(String(128))
    taos_equipment_code = Column(String(255))
    AssetCode = Column(String(128))
    LeaveFactoryCode = Column(String(128))
    ElectronicCode = Column(String(128))
    EquipmentType = Column(String(64))
    Brand = Column(String(64))
    Specs = Column(String(64))
    Unit = Column(String(32))
    Source = Column(String(128))
    Manufacturer = Column(String(128))
    Status = Column(String(128))
    PurchaseTime = Column(String(128))
    PurchaseMoney = Column(String(64))
    WarrantyTime = Column(String(128))
    UseTime = Column(String(128))
    ScrapTime = Column(String(128))
    Grade = Column(String(64))
    Director = Column(String(64))
    Department = Column(String(128))
    Line = Column(String(255))
    Station = Column(String(128))
    Position = Column(String(128))
    IsCalculate = Column(String(32))
    IsDepreciation = Column(String(32))
    NetValue = Column(String(64))
    TechnicalParameter = Column(String(128))
    Comment = Column(String(32))
    QRCode = Column(Text)
    Picture = Column(String(5120))


class Equipmentalarmtag(Base):
    __tablename__ = 'equipmentalarmtag'

    ID = Column(BIGINT(255), primary_key=True)
    alarm_name = Column(String(255))
    alarm_grade_code = Column(String(255))
    alarm_group_code = Column(String(255))
    alarm_class_code = Column(String(255))
    alarm_position = Column(String(255))
    alarmmodeID = Column(String(255))
    taos_equipment_code = Column(String(255))
    equipmentcode = Column(String(255))
    calc_class = Column(String(255))
    taos_field_name = Column(String(255))
    ifconditions = Column(String(255))
    symbol = Column(String(255))
    standvalue = Column(String(255))
    condition_relation = Column(String(255))
    alarm_deadzone = Column(String(255))
    alarm_duration = Column(String(255))
    redistag = Column(String(255))
    is_stop = Column(String(255))
    description = Column(String(255))
    is_writeredis = Column(String(255))
    readredistable = Column(String(255))
    writeredistable = Column(String(255))
    equipmentID = Column(String(255))


class EquipmentalarmtagAi(Base):
    __tablename__ = 'equipmentalarmtag_ai'

    ID = Column(BIGINT(255), primary_key=True)
    alarm_name = Column(String(255), nullable=False, comment='')
    alarm_grade_code = Column(String(255), comment='')
    alarm_group_code = Column(String(255), comment='')
    alarm_class_code = Column(String(255), comment='')
    alarm_position = Column(String(255), comment='')
    alarmmodeID = Column(String(255), comment='')
    taos_equipment_code = Column(String(255), comment='')
    equipmentcode = Column(String(255), comment='')
    taos_field_name = Column(String(255), comment='')
    ifconditions = Column(String(255), comment='')
    symbol = Column(String(255), comment='')
    standvalue = Column(String(255), comment='')
    llow = Column(String(255), comment='')
    low = Column(String(255), comment='')
    high = Column(String(255), comment='')
    hhigh = Column(String(255), comment='')
    normal = Column(String(255), comment='')
    consistent = Column(String(255), comment='')
    alarm_deadzone = Column(String(255), comment='')
    is_stop = Column(TINYINT(1), comment='')
    description = Column(String(255), comment='')
    equipmentID = Column(String(255))
    readredistable = Column(String(255))
    writeredistable = Column(String(255))

class EquipmentalarmtagCopy1(Base):
    __tablename__ = 'equipmentalarmtag_copy1'

    ID = Column(BIGINT(255), primary_key=True)
    alarm_name = Column(String(255))
    alarm_grade_code = Column(String(255))
    alarm_group_code = Column(String(255))
    alarm_class_code = Column(String(255))
    alarm_position = Column(String(255))
    alarmmodeID = Column(String(255))
    equipmentcode = Column(String(255))
    calc_class = Column(String(255))
    ifconditions = Column(String(255))
    symbol = Column(String(255))
    standvalue = Column(String(255))
    condition_relation = Column(String(255))
    alarm_deadzone = Column(String(255))
    alarm_duration = Column(String(255))
    redistag = Column(String(255))
    is_stop = Column(String(255))
    description = Column(String(255))
    is_writeredis = Column(String(255))
    readredistable = Column(String(255))
    writeredistable = Column(String(255))
    equipmentID = Column(String(255))


class Equipmentruneventdetail(Base):
    __tablename__ = 'equipmentruneventdetail'

    ID = Column(BIGINT(255), primary_key=True)
    equipmentID = Column(String(255))
    equipmentcode = Column(String(255))
    UUID = Column(String(255))
    event_name = Column(String(255))
    event_starttime = Column(String(255))
    event_endtime = Column(String(255))
    event_duration_time = Column(String(255))
    description = Column(String(255))
    event_year = Column(String(255))
    event_month = Column(String(255))
    event_day = Column(String(255))
    event_hour = Column(String(255))
    event_minute = Column(String(255))
    event_second = Column(String(255))
    event_status = Column(String(255))


class Equipmentrunmodel(Base):
    __tablename__ = 'equipmentrunmodel'

    ID = Column(BIGINT(20), primary_key=True)
    equipmentID = Column(BIGINT(20))
    equipmentcode = Column(String(100))
    calc_class = Column(String(50))
    statistical_type = Column(String(50))
    readredistable = Column(String(255))
    ifconditions = Column(String(255))
    symbol = Column(String(255))
    condition_relation = Column(String(255))
    standvalue = Column(String(255))
    duration_time = Column(String(50))
    writeredistable = Column(String(255))
    redistag = Column(String(255))
    description = Column(String(100))


class EquipmentrunmodelCopy1(Base):
    __tablename__ = 'equipmentrunmodel_copy1'

    ID = Column(BIGINT(20), primary_key=True)
    equipmentID = Column(BIGINT(20))
    equipmentcode = Column(String(50))
    calc_class = Column(String(50))
    statistical_type = Column(String(50))
    readredistable = Column(String(255))
    ifconditions = Column(String(50))
    symbol = Column(String(50))
    condition_relation = Column(String(50))
    standvalue = Column(String(50))
    duration_time = Column(String(50))
    writeredistable = Column(String(255))
    redistag = Column(String(50))
    description = Column(String(100))


class Manualreportalarm(Base):
    __tablename__ = 'manualreportalarm'

    ID = Column(BIGINT(20), primary_key=True)
    alarm_class_code = Column(String(50))
    alarm_grade_code = Column(String(50))
    alarm_group_code = Column(String(50))
    alarm_starttime = Column(DateTime)
    alarm_endtime = Column(DateTime)
    alarm_duration_time = Column(String(50))
    description = Column(String(100))
    alarm_year = Column(String(50))
    alarm_month = Column(String(50))
    alarm_day = Column(String(50))
    alarm_hour = Column(String(50))
    alarm_minute = Column(String(50))
    alarm_second = Column(String(50))
    alarm_status = Column(String(50))


class OpcAlarmTagRedistag(Base):
    __tablename__ = 'opc_alarm_tag_redistag'

    ID = Column(BIGINT(20), primary_key=True)
    opctag = Column(String(100))
    divdata = Column(String(50))
    redistag = Column(String(50))
    position = Column(DateTime)
    description = Column(String(100))


class Tag(Base):
    __tablename__ = 'tag'

    id = Column(INTEGER(11), primary_key=True)
    tag_id = Column(String(255))
    taos_field_name = Column(String(255))
    taos_equipment_code = Column(String(255))
    EquipmentCode = Column(String(255))
    tag_means = Column(String(32))
    upper_limit = Column(INTEGER(8))
    lower_limit = Column(INTEGER(8))


class Watersteamprice(Base):
    __tablename__ = 'watersteamprice'

    ID = Column(BIGINT(255), primary_key=True)
    PriceValue = Column(String(255))
    PriceType = Column(String(255))
    IsEnabled = Column(String(255))
    StartTime = Column(String(255))
    EndTime = Column(String(255))
    Description = Column(String(255))
    Unit = Column(String(255))
